<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/CMS.Master" Inherits="Shop.Framework.Page.CMS_CategoryPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <title>Category Content Management System</title>
    <link href="/Content/cmsCategoryStyle.css" rel="Stylesheet" type="text/css" />

    <script src="/Scripts/cmsCategory.js" type="text/javascript" language="javascript"></script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (CMSRuntime.Instance.IsLoggedIn()) { %>
    <h2>
        Category List</h2>
    <div class="clear">
    </div>
    <div class="left detailWrapper">
        <form action="/cms/saveCategory" id="category_detail" method="post"">
        <table>
            <%if (CategoryInView == null) {
                  CategoryInView = new Shop.Model.Category {
                      Description = "New",
                      IsDisabled = true,
                      Keywords = "New",
                      Name = "New",
                      Tags = "New",
                      Title = "New"                    
                  };
                    
            }%>
            <tr>
                <td align="right">
                    Category Name<input type="hidden" name="idCategory" value="<%=CategoryInView.IdCategory %>" />
                </td>
                <td align="left" class="style1">
                    <input type="text" name="name" style="width: 214px" value="<%=CategoryInView.Name %>" />
                </td>
            </tr>
            <tr>
                <td align="right">
                    Category Description
                </td>
                <td align="left" class="style1">
                    <input type="text" name="description" style="height: 90px; width: 214px" value="<%=CategoryInView.Description %>" />
                </td>
            </tr>
            <tr>
                <td align="right">
                    Category Tags
                </td>
                <td align="left" class="style1">
                    <input type="text" name="tags" style="width: 214px; height: 101px" value="<%=CategoryInView.Tags %>" />
                </td>
            </tr>
            <tr>
                <td align="right">
                    Category Keywords
                </td>
                <td align="left" class="style1">
                    <input type="text" name="keywords" style="width: 214px; height: 84px" value="<%=CategoryInView.Keywords %>" />
                </td>
            </tr>
            <tr>
                <td align="right">
                    Category Title
                </td>
                <td align="left" class="style1">
                    <input type="text" name="title" style="width: 214px" value="<%=CategoryInView.Title %>" />
                </td>
            </tr>
            <tr>
                <td>
                    Disabled
                </td>
                <td align="left">
                    <%if (CategoryInView.IsDisabled) { %>
                    <select name="isDisabled" oninit="$(this).val('true')">
                        <option value="true">Yes</option>
                        <option value="false">No</option>
                        <%} else { %>
                        <select name="isDisabled" oninit="$(this).val('false')">
                            <option value="false">No</option>
                            <option value="true">Yes</option>
                            <%} %>
                        </select>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" name="add" value="Save" />
                    <input type="button" value="New" onclick="CMS_Category.New()" />
                </td>
            </tr>            
            
        </table>
        </form>
    </div>
    <div class="left catListWrapper">
        <table class="catList">
            <%foreach (var cat in CategoryList) {%>
            <tr>
                <td>
                    <form action="/cms/listAction" method="post" id="form<%=cat.Name %>">
                    <input type="hidden" name="idCategory" value="<%=cat.IdCategory %>" />
                    <div class="left" style="width: 200px; background-color: #999966;">
                        <%=cat.Name %></div>
                    <div class="left">
                        <%--<input type="submit" value="Disable" name="Disable" />--%>
                        <input type="submit" name="Select" value="Select" />
                        <input type="button" name="some" onclick="window.location = '/cms/<%=cat.IdCategory %>/product-list';"
                            value="Products" />
                    </div>
                    </form>
                </td>
            </tr>
            <% }%>
        </table>
    </div>
    <%} else {%>
    <style type="text/css">
        #loginWrapper
        {
            width: 350px;
            margin: 0 auto;
            padding-top: 20px;
            border: solid 2px #0099FF;
        }
        .login_label
        {
            width: 190px;
            font-weight: bold;
        }
        .login_input_wrapper
        {
            padding: 5px;
        }
    </style>
    <div style="padding-top: 100px;">
    </div>
    <div style="margin: 0 auto; width: 350px;">
        <h2>
            Administrator Login</h2>
    </div>
    <div id="loginWrapper">
        <br />
        <form action="/cms/login" method="post">
        <div class="login_input_wrapper">
            <div class="login_label left">
                Enter Admin ID</div>
            <div class="left">
                <input type="text" name="login" />
            </div>
            <div class="clear">
            </div>
        </div>
        <div class="login_input_wrapper">
            <div class="login_label left">
                Enter Admin Password
            </div>
            <div class="left">
                <input type="password" name="password" />
            </div>
            <div class="clear">
            </div>
        </div>
        <input type="submit" value="Login To Panel" />
        <hr />
        </form>
    </div>
    <%} %>
</asp:Content>
